const app = getApp();
Page({
  data:{
    result:{}
  },
  onLoad:function(option){
    if(option.result){
      this.setData({
        result:JSON.parse(option.result)
      })
      console.log(option.result)
    }
  },
  saveLogin: function () {
    let _this = this;
    let result = this.data.result;
    if(result){
      wx.request({
        url: app.globalData.path + 'services/QRCodeVerify',
        data: {
          connectionId: result.connectionid,
          uuid: result.uuid,
          token: app.globalData.authorization
        },
        method: 'POST',
        header: {
          'content-type': 'application/json', // 默认值
          'Authorization': 'Bearer ' + app.globalData.authorization
        },
        success: function (res) {
          console.log(res.data);
          if (res.data.success) {
            console.log("成功")
            wx.reLaunch({
              url: '/pages/index/index',
            })
          } else {
            wx.showToast({
              title: '二维码过期，请重新扫码 ',
              icon: 'none',
              duration: 2000
            })
          }
        }
      })
    }
  },
  outlogin: function(){
    wx.switchTab({
      url: '/pages/index/index',
    })
  }
})